#include <iostream>
#include <queue>
using namespace std;

int n;
int m;
int grid[405][405];
int x;
int y;
struct node {
    int r;
    int c;
};

int dr[8] = {-2, -2, -1, 1, 2, 2, 1, -1};
int dc[8] = {1, -1, -2, -2, -1, 1, 2, 2};

bool ok(int r, int c) {
    if (r < 0 || r >= n || c < 0 || c >= m) return 0;
    return 1;
}

int main() {
    cin >> n;
    cin >> m;
    cin >> x;
    cin >> y;
    x -= 1;
    y -= 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            grid[i][j] = -1;
        }
    }
    grid[x][y] = 0;
    queue<node> Q;
    Q.push(node{x, y});
    while (!Q.empty()) {
        int r = Q.front().r;
        int c = Q.front().c;
        for (int i = 0; i < 8; i++) {
            int fr = r + dr[i];
            int fc = c + dc[i];
            if(!ok(fr, fc)) continue;
            if(grid[fr][fc] != -1) continue;
            grid[fr][fc] = grid[r][c] + 1;
            Q.push(node{fr,fc});
        }
        Q.pop();
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cout << grid[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}